var _util = _interopRequireDefault(require("../../../utils/util"));

function _interopRequireDefault(t) {
    return t && t.__esModule ? t : {
        default: t
    };
}

var common = null, id = 1, register = {}, app = getApp();

Component({
    properties: {
        mode: {
            type: String,
            value: "normal"
        },
        isShown: {
            type: Boolean,
            value: !1
        },
        top: {
            type: String,
            value: app.globalData.NAVBAR_TOTAL_HEIGHT + "px"
        },
        height: {
            type: String,
            value: "80px"
        },
        position: {
            type: String,
            value: "top"
        }
    },
    ready: function() {
        this.init();
    },
    detached: function() {
        delete register["".concat(this._id)];
    },
    methods: {
        init: function() {
            this._id = id++, "view" === (register["".concat(this._id)] = this).data.mode && common && this.setData({
                params: common,
                isShown: !0
            });
        },
        _onHide: function() {
            var t = this.data.mode;
            Object.keys(register).forEach(function(t) {
                register[t].setData({
                    isShown: !1
                });
            }), "view" === t && (common = null), this.triggerEvent("hide");
        },
        viewAgain: function() {
            var t = this.data.params.query.card;
            this.$route("/pages/card/view/view", t), this._onHide();
        },
        gotoIntro: function() {
            this.$report("home_tap_find_out_detail"), this.$route("/pages/card/intro/intro");
        },
        _onEdit: function() {
            this.$route("/pages/card/edit/edit");
        },
        gotoOfficial: function() {
            var t = this;
            _util.default.savePhotoToAlbum("https://oss.ibos.cn/common/minicard/official.png").then(function() {
                return t.$route("/pages/view/view?type=official&save=1");
            });
        }
    }
});